package progetto;

import peersim.config.Configuration;
import peersim.core.Control;

public class SimInitializer implements Control {
	
	
	private static final double DEFAULT_SIZE = 500;
	
	private static final String PAR_SIZE = "size_square";
	
	/**
	 * The Bluetooth transmission radius parameter. 
	 * It must has a value in the interval [10, 30] m
	 * Default value: 20m.
	 * 
	 * @config
	 */
	private static final String PAR_RADIUS = "radius";
	
	/**
	 * Default value of Bluetooth transmission radius
	 */
	//private static final int DEFAULT_RADIUS = 20;
	
	private static double size;
	
	private static double radiusPercent;
	
	

	public SimInitializer(String prefix) {
		size = Configuration.getDouble(prefix + "." + PAR_SIZE, DEFAULT_SIZE);
		radiusPercent = Configuration.getDouble(prefix + "." +PAR_RADIUS, BluetoothTransm.DEFAULT_RADIUS);
	}	
	
	
	@Override
	public boolean execute() {
		
		SquareSize.getIstance().initializesSize(size);
		BluetoothTransm.getInstance().initializesRadius(radiusPercent);
		
		return false;
	}

}
